﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using HZ.Supervise.IBLL;
using HZ.Supervise.Model;
using HZ.Supervise.Model.Query;
using System.Text;
namespace HZ.Supervise.Web.Common
{
    /// <summary>
    /// $codebehindclassname$ 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class GetArea : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string AreaID = context.Request.QueryString["areaid"];
            //if (string.IsNullOrEmpty(areaid))
            //{
            //    context.Response.End();
            //} context.Response.Write("{'南京市':'320010', '盐城市':'320020'}");

            
            IBLL_Area ia = new HZ.Supervise.BLL.BLL_Area();
            IList<Area> lstArea = new List<Area>();
            int outcount;
            lstArea = ia.GetSonAreas(AreaID, 1, 0, out outcount);
            {
                StringBuilder strb = new StringBuilder();
                strb.Append("'全部':'0'");
                foreach (Area area in lstArea)
                {
                    strb.Append(",'"+area.AreaName+"':'"+area.AreaID+"'");
                }
                context.Response.Write("{"+strb.ToString()+"}");
            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
         
    }
}
